﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bootstrap.MVC.Common;
using Bootstrap.MVC.Infrastructure.Html;
using Bootstrap.MVC.Utils;

namespace Bootstrap.MVC.Widgets
{
    public class ButtonGroupHtmlGenerator : HtmlGeneratorBase<ButtonGroupModel>
    {
        public ButtonGroupHtmlGenerator(ButtonGroupModel model) : base(model) { }

        public override string Render()
        {
            var divTag = new HtmlTagBuilder("div").AddClass("btn-group");

            foreach (var btn in Model.Buttons)
            {
                divTag.Append(new ButtonHtmlGenerator(btn).AsHtmlBuilder());
            }

            return divTag.Render();
        }
    }
}
